﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using LibraryBLL;
using LibraryBLL.BookBLL;

namespace WebAppLibrary.Json
{
    public partial class MainGrid : System.Web.UI.Page
    {
        protected string strJson = string.Empty;

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    GetOpenBookInfoAll();
                }
            }
            catch (Exception ex)
            {
                strJson = @"{success:false}";
            }
        }

        /// <summary>
        /// 查询所有的图书信息(首页的Grid,带搜索功能)
        /// </summary>
        private void GetOpenBookInfoAll()
        {
            if (Request.Form["msg"] != null)
            {
                OpenBookInfoBLL orib = new OpenBookInfoBLL();
                string message = Request.Form["msg"];
                string str = orib.GetOpenBookInfoAll(message);
                strJson = str;
            }
            else
            {
                OpenBookInfoBLL orib = new OpenBookInfoBLL();
                string str = orib.GetOpenBookInfoAll("");
                strJson = str;
            }
        }
    }
}
